<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateFeedbackTable extends Migration
{
    public function up()
    {
        //用户反馈
        Schema::create('feedback', function (Blueprint $table) {
            $table->increments('id');
            $table->string('username', 20)->comment('用户名');
            $table->string('nick_name', 50)->nullable()->comment('昵称');
            $table->string('title')->comment('标题');
            $table->text('content')->comment('内容');
            $table->text('reply')->nullable()->comment('回复内容');
            $table->string('manager_username', 20)->nullable()->comment('管理员ID');
            $table->string('manager_nick_name', 50)->nullable()->comment('管理员昵称');
            $table->unsignedTinyInteger('status')->default(0)->comment('处理结果 0未处理 1已受理 2已处理 ');
            $table->unsignedTinyInteger('reading')->default(false)->comment('阅览状态');
            $table->unsignedTinyInteger('star')->default(0)->comment('处理评分 1-5');
            $table->timestamp('accepted_time')->nullable()->comment('受理时间');
            $table->timestamp('processed_time')->nullable()->comment('处理时间');
            $table->ipAddress('user_ip')->nullable()->comment('用户IP');
            $table->boolean('deleted')->default(false)->comment('删除');
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::dropIfExists('feedback');
    }
}
